use serde::{Deserialize, Serialize};
use poem_openapi::{Object};
use validator::Validate;

#[derive(Clone, Debug, Serialize, Deserialize, Object)]
pub struct PingResponse {
    pub ping: String,
}

// #[derive(Clone, Debug, Default, Serialize, Deserialize, Object)]
// pub struct ListTaskRequest {
//     pub page: Option<u64>,
//     pub page_size: Option<u64>,
//     pub title: Option<String>,
// }

#[derive(Clone, Debug, Default, Serialize, Deserialize, Object, Validate)]
pub struct UpdateTaskRequest {
    #[validate(range(min = 1, message = "ID必须大于0"))]
    pub id: i64,
    #[validate(required)]
    pub title: Option<String>,
    pub description: Option<String>,
    pub done: Option<bool>,
}

#[derive(Clone, Debug, Serialize, Deserialize, Object, Validate)]
pub struct CreateTaskRequest {
    #[validate(required)]
    pub title: Option<String>,
    pub description: Option<String>,
    pub done: Option<bool>,
}
